package com.cm.tianwt.socks.test.http.ftp;

import java.net.Authenticator;

import org.apache.commons.net.ftp.FTPClient;

import com.cm.tianwt.socks.test.http.MyAuthenticator;

public class FtpTestMain {


 
    /**
     * 登录名
     */
    private static String userName = "anonymous";//匿名登录，空字符串不行
    /**
     * 登录密码
     */
    private static String password = "tianweitong@conew.com";//随便一个地址

	  public static void main(String[] args) {
		  try {
			  
			System.getProperties().put( "socksProxyPort", "8888"); 
		    System.getProperties().put( "socksProxyHost" ,"127.0.0.1");
		    Authenticator.setDefault(new MyAuthenticator("admin", "nimda"));
		        
	        FTPUtil ftpUtils = new FTPUtil();
	        FTPClient ftp = ftpUtils.getFTPClient("ftp.videolan.org", 21, userName,password);
	        ftpUtils.downLoadFTP(ftp, "/pub/videolan/vlc-android/3.1.6/", "VLC-Android-3.1.6-arm64-v8a.apk", "/Users/tianweitong/test");
	        //test.copyFile(ftp, "/file", "/txt/temp", "你好.txt");
	        //test.uploadFile(ftp, "C:\\下载\\你好.jpg", "/");
	        //test.moveFile(ftp, "/file", "/txt/temp");
	        //test.deleteByFolder(ftp, "/txt");
	        //ftpUtils.readFileByFolder(ftp, "/pub/videolan/vlc-android/3.1.6/");
	        ftpUtils.closeFTP(ftp);
	       
		  }catch(Exception e) {
			  e.printStackTrace();
		  }
	  }
}
